<form class="layui-form layui-form-pane" lay-filter="FormSysResourceMatch" action="/sys/resource/match">
    <input type="hidden" id="id" name="id" th:value="${entity.id}">
    <div class="layui-row p-l-sm m-b-xl">
        <div class="layui-row">
            <div th:replace="common/plugin :: pa-form-input-detail('text','所属系统','layui-col-md4',${sysSystem.systemName})"></div>
            <div th:replace="common/plugin :: pa-form-input-detail('text','所属模块','layui-col-md4',${sysModel.modelName})"></div>
            <div th:replace="common/plugin :: pa-form-input-detail('text','父资源','layui-col-md4',${resName})"></div>
        </div>
        <div class="hr-line-dashed m-r m-t"></div>
        <div class="layui-row p-r-sm" layoutH="300">
            <table class="layui-table">
                <thead>
                <tr>
                    <th>匹配路径（点击选中路径）</th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="item:${reqList}" class="warning ljMatchBtn" th:tid="${item}">
                    <td style="min-width:60px;" th:inline="text">[[${item}]]</td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>
</form>
<script>
    layui.use(["jquery", 'form', 'okLayer'], function () {
        let form = layui.form;
        let $ = layui.jquery;
        let okLayer = layui.okLayer;
        form.render();
        $("[layoutH]").layoutH();
        $(".ljMatchBtn").on("click", function () {
            let ljUrl = $(this).attr("tid");
            okLayer.sweetConfirm("是否匹配改地址:[" + ljUrl + "]?", function (index) {
                $.ajax({
                    type: 'POST', url: "/sys/resource/match", dataType: "json", data: {
                        id: [[${entity.id}]],
                        url: ljUrl
                    }, cache: false, success: function (data) {
                        if (data.statusCode == '200') {
                            okLayer.sweetSuccess("提交成功", data.message, function () {
                                console.log(1111);
                                window.location.reload();
                            });
                        } else {
                            okLayer.sweetError("提交失败", data.message);
                        }
                    }, error: function (xhr) {
                        okLayer.sweetError("请求页面异常:" + xhr.status, xhr.responseText);
                        return;
                    }
                });
            });
        });
    });
</script>